home *** CD-ROM | disk | FTP | other *** search
- Path: mail2news.demon.co.uk!escan.demon.co.uk
- From: Bill Birrell <bill@escan.demon.co.uk>
- Newsgroups: comp.lang.c
- Subject: How to tell if a file exists in C
- Date: Tue, 06 Feb 1996 08:10:00
- Message-ID: <823685019.AA00170@escan.demon.co.uk>
- Reply-To: bill@escan.demon.co.uk
- X-NNTP-Posting-Host: escan.demon.co.uk
- X-Mail2News-Path: escan.demon.co.uk
-
- > Hi, how do I find out if a file already exists
- > in UNIX C? On PCs I would do a findfirst/findnext,
- > is there an equivalent on Unix?
-
- Check up on access() and stat(). There cannot be an exact equivalent to
- Digital Research's findfirst and findnext functions in unix, because unix has
- a completely different file structure from CP/M or PC-Dos (later MsDos), and
- therefore has no idea what FCBs are. Files, directories and devices are all
- accessed the same way, and when you become used to it, it is a *much* simpler
- and more logical approach. Take a look at K&R Chapter 8 [Either edition - it's
- in both].
-
- Bill.
-
-
- --
- Regards,
- Bill Birrell.
- internet: bill@escan.demon.co.uk
-